package com.dimeng;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import com.dimeng.utils.CommonUtil;

public class LoginActivity extends Activity {
	private TextView userName;
	private TextView pwd;
	private Button button;
	
    public void onCreate(Bundle savedInstanceState) {
    	super.onCreate(savedInstanceState);
    	setContentView(R.layout.login);
    	 CommonUtil.checkNetWorkStatus(this,true);
        userName = (TextView) findViewById(R.id.userName);
        pwd = (TextView)findViewById(R.id.pwd);
        button = (Button)findViewById(R.id.login);
        button.setOnClickListener(new Button.OnClickListener(){
			public void onClick(View v) {
				if ("".equals(userName.getText().toString().trim())){
					Toast.makeText(LoginActivity.this, "用户名不能为空", Toast.LENGTH_SHORT).show();
				} else if ("".equals(pwd.getText().toString().trim())){
					Toast.makeText(LoginActivity.this, "密码不能为空", Toast.LENGTH_SHORT).show();
				} else {
					String hostUrl = getText(R.string.host_url).toString();
					String url = hostUrl+"memberLogin.do?member.loginName="
								+ userName.getText().toString().trim()
								+"&member.password="+pwd.getText().toString().trim();
					WebView webView = new WebView(LoginActivity.this);
					setContentView(webView);
					webView.loadUrl(url);
				}
			}
        });
    }
}